//
//  UIView+Frame.m
//
//  Created by Laki on 16/4/2.
//  Copyright © 2016年 SG All rights reserved.
//

#import "UIView+Frame.h"

@implementation UIView (Frame)

/**
 *  快速加载Xib
 */
+ (instancetype)wsg_viewFormXib{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].firstObject;
}

- (CGFloat)wsg_x{
    return self.frame.origin.x;
}

- (void)setWsg_x:(CGFloat)wsg_x{
    CGRect frame = self.frame;
    frame.origin.x = wsg_x;
    self.frame = frame;
}

- (CGFloat)wsg_y{
    return self.frame.origin.y;
}

- (void)setWsg_y:(CGFloat)wsg_y{
    CGRect frame = self.frame;
    frame.origin.y = wsg_y;
    self.frame = frame;
}

- (CGFloat)wsg_width{
    return self.frame.size.width;
}

- (void)setWsg_width:(CGFloat)wsg_width{
    CGRect frame = self.frame;
    frame.size.width = wsg_width;
    self.frame = frame;
}

- (CGFloat)wsg_height{
    return self.frame.size.height;
}

- (void)setWsg_height:(CGFloat)wsg_height{
    CGRect frame = self.frame;
    frame.size.height = wsg_height;
    self.frame = frame;
}

- (CGFloat)wsg_centerX
{
    return self.center.x;
}

- (void)setWsg_centerX:(CGFloat)wsg_centerX
{
    CGPoint center = self.center;
    center.x = wsg_centerX;
    self.center = center;
}

- (CGFloat)wsg_centerY
{
    return self.center.y;
}

- (void)setWsg_centerY:(CGFloat)wsg_centerY
{
    CGPoint center = self.center;
    center.y = wsg_centerY;
    self.center = center;
}

@end
